<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <p>元指参与运算的”操作数“</p>

    <h3>三元运算符的基础语法</h3>

    <p>(条件) ? 表达式1 : 表达式2</p>

    <p>如：</p>
    <p>a + b === 2 ? console.log("是的") : console.log("不是")</p>

    <script>
        console.log("***练习开始***");

        var a = 1;
        var b = 1;
        a + b === 2 ? console.log("是的") : console.log("不是");

        console.log("***练习结束***");
    </script>
</body>

</html>